<?php

class WEATHERDataParser extends DOMDataParser
{
    public function parseData($data)
    {
        $dom = new DOMDocument();
        /* there might be errors, who knows what we're getting */
        if (!@$dom->loadHTML(mb_convert_encoding($data, 'HTML-ENTITIES', $this->encoding))) {
            $dom = false;
        } else {
            $dom = $this->rewriteAbsoluteUrls($dom);
        }

        if ($dom) {
            $elements = $dom->getElementsByTagName('table');
            $element1 = $elements->item(0)->getElementsByTagName('td');
            $content = $dom->saveXML($element1->item(1));
        }
        return $content;
    }
}
